﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class ConfirmPanel : BasePanel<ConfirmPanel>
{
    public CustomLabel labTitle;
    public CustomLabel labMessage;
    public CustomGUIButton btnClose;
    public CustomGUIButton btnConfirm;
    public CustomGUIButton btnCancel;
    void Start()
    {
        Hide();
    }

    public void InitConfirmPanel(string title, string message, UnityAction confirmEvent, UnityAction cancelEvent)
    {
        labTitle.SetText(title);
        labMessage.SetText(message);
        btnConfirm.clickEvent += confirmEvent;
        btnClose.clickEvent += cancelEvent;
        btnCancel.clickEvent += cancelEvent;
    }

    public void InitConfirmPanel(string title, string message, string confirm, string cancel, UnityAction confirmEvent, UnityAction cancelEvent)
    {
        labTitle.SetText(title);
        labMessage.SetText(message);
        btnConfirm.content.text = confirm;
        btnCancel.content.text = cancel;
        btnConfirm.clickEvent += confirmEvent;
        btnClose.clickEvent += cancelEvent;
        btnCancel.clickEvent += cancelEvent;
    }
}
